<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //forEach() 遍历数组，不返回值，仅用于遍历
    const arr = [1,2,3]
    const arr1=arr.forEach(item=>{
     return item +=1
      console.log(item);//1 2 3
    })
    console.log(arr1);//undefined不返回新的数组
    console.log(arr);//不改变原数组
  </script>
</body>
</html>